//
//  YidaoViewController.m
//  AllDome
//
//  Created by 张振宇 on 15/11/6.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "YidaoViewController.h"
#import "RootTabBarController.h"
@interface YidaoViewController ()

@end

@implementation YidaoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initGuide];
    // Do any additional setup after loading the view.
}
- (void)initGuide
{
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
    [scrollView setContentSize:CGSizeMake(kWidth *3, 0)];
    [scrollView setPagingEnabled:YES];  //视图整页显示
    scrollView.showsHorizontalScrollIndicator = NO;
       [scrollView setBounces:NO]; //避免弹跳效果,避免把根视图露出来
    
    UIImageView *imageview1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
    [imageview1 setImage:[UIImage imageNamed:@"img1.png"]];
    [scrollView addSubview:imageview1];
    
    UIImageView *imageview2 = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth, 0, kWidth, kHeight)];
    [imageview2 setImage:[UIImage imageNamed:@"img2.png"]];
    [scrollView addSubview:imageview2];
    
    UIImageView *imageview3 = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth *2, 0, kWidth, kHeight)];
    [imageview3 setImage:[UIImage imageNamed:@"img3.png"]];
    imageview3.userInteractionEnabled = YES;    //打开imageview3的用户交互;否则下面的button无法响应
    [scrollView addSubview:imageview3];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];//在imageview3上加载一个透明的button
    [button setTitle:@"立即体验" forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor colorWithRed:0.997 green:0.000 blue:1.000 alpha:1.000]];
    [button setFrame:CGRectMake(kWidth/2 - 100, kHeight - 120, 200, 40)];
    [button setTintColor:[UIColor whiteColor]];
    [button addTarget:self action:@selector(firstpressed) forControlEvents:UIControlEventTouchUpInside];
    [imageview3 addSubview:button];
    
    [self.view addSubview:scrollView];
}
- (void)firstpressed
{
    RootTabBarController *tabBarVC = [[RootTabBarController alloc]init];
    [self presentViewController:tabBarVC animated:NO completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
